package com.service.impl;

import com.bean.Customer;
import com.dao.CustomerDao;
import com.dao.impl.CustomerDaoImpl;
import com.service.CustomerService;

import java.util.List;

public class CustomerServiceImpl implements CustomerService {
    private CustomerDao customerDao = new CustomerDaoImpl();

    @Override
    public List<Customer> getAllCustomer() {
        return customerDao.getAllCustomer();
    }

    @Override
    public boolean addCustomer(String customerName, String director, String directorTel, String directorEmail,
                               String address, String manage_range) {
        if (customerDao.addCustomer(customerName,director,directorTel,directorEmail,address,manage_range) > 0) {
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateCustomer(int key, String tel, String director, String manageRange) {
        if (customerDao.updateCustomer(key,tel,director,manageRange) > 0) {
            return true;
        }else {
            return false;
        }
    }

    @Override
    public Customer getCustomerInfo(int key) {
        return customerDao.getCustomerInfo(key);
    }

    @Override
    public List<Customer> findCustomer(String customerName, String manageRange) {
        return customerDao.findCustomer(customerName,manageRange);
    }
}
